---冲锋会原始位置
---@class SkillEffect294101:BaseSkillEffect
SkillEffect294101 = ClientFight.CreateClass("SkillEffect294101",ClientFight.BaseSkillEffect)
local t = SkillEffect294101
---@param skill FightUsingSkill
---@param position Vector2
function t.prepareSkill(skill,position)
    local fight = skill.fight
    local fighter = skill.fighter
    local target = skill.target
    local skillBean = skill.skill.skillBean
    local parentSkill = skill.parentSkill


    -- 前摇阶段
    skill.stage = FightSkillStageEnum.PREPARE

    skill.separate = skillBean.f_SkillOut == 1

    -- 指向左或右方向
    skill.targetDirection = FighterUtils.leftOrRight(fighter, parentSkill.startPosition)
    skill.targetPosition = parentSkill.startPosition

    local pos = Vector2(position.x,position.y);
    if (skill.separate and skillBean.f_Speed == 0 and skillBean.f_moveFrame == 0) then
        if (skillBean.f_SkillPoint == SkillTargetDirectingEnum.TARGET
                or skillBean.f_SkillPoint == SkillTargetDirectingEnum.PLACE) then
            pos = Vector2(target.position.x,target.position.y)
        elseif (skillBean.f_SkillPoint == SkillTargetDirectingEnum.PARENT and skill.parentSkill ~= nil) then
            local parentSkillBean = skill.parentSkill.skill.skillBean
            if (parentSkillBean.f_SkillPoint == SkillTargetDirectingEnum.TARGET
                    and parentSkillBean.f_SkillPoint == SkillTargetDirectingEnum.PLACE) then
                pos = Vector2(target.position.x,target.position.y);
            end
        end
    end
    if (skillBean.f_SkillShifting ~= nil) then
        pos.x = pos.x + skill.targetDirection * skillBean.f_SkillShifting[1]
        pos.y = pos.y + skillBean.f_SkillShifting[1]
    end
    -- 设置起始坐标
    skill.position = pos
    skill.startPosition = Vector2(pos.x,pos.y)

    if (skillBean.f_SkillShape ~= nil) then
        skill.skillShape = Rectangle2.New(skillBean.f_SkillShape)
    else
        skill.skillShape = fighter.shape
    end

    if (not skill.separate) then
        fighter.usingSkill = skill
    end

    local prepareTime = 0 ;-- skill.skill.skillBean.f_PrepareTime
    local speed = skill.speed

    -- 计算攻击前摇帧数
    local frame = math.ceil(prepareTime * speed / Global.FIGHT_FRAME);
    SkillRoleMgr.savePathFile(
   "[" .. fight.frame .. "][SKILL]" .. fighter.fighterId .. "(" .. fighter.position .. ")对"
    .. target.fighterId .. "(" .. target.position .. ")攻击，使用技能" .. skillBean.f_SkillID
    .. "前摇阶段在" .. frame .. "帧后结束");
    if (frame > 0) then
        skill.stageFinishFrame = frame
    else
        SkillManager.releaseSkill(skill);
    end
    return true;

end
t.New()